package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.mapper.BrandLogMapper;
import com.itheima.pojo.BrandLog;
import com.itheima.service.BrandLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandLogServiceImpl implements BrandLogService {
    @Autowired
    private BrandLogMapper brandLogMapper;
    /**
     * 添加日志
     * @param brandLog
     */
    @Override
    public void addBrandLog(BrandLog brandLog) {
        brandLogMapper.addBrandLog(brandLog);
    }

    @Override
    public PageInfo<BrandLog> selectByPage(Integer currentPage, Integer pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        List<BrandLog> list = brandLogMapper.selectAll();
        //封装分页结果
        return new PageInfo<>(list);
    }
}
